package samples.d2.trames 
{
	import flash.geom.Matrix;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import samples.BaseSample;
	import shapes.shapes2D.distribution.Grid;
	import shapes.shapes2D.distribution.Hexagonal;
	import shapes.shapes2D.distribution.poissondisk.PoissonDisk;
	import shapes.shapes2D.distribution.Triangular;
	import shapes.shapes2D.Dot;
	
	/**
	 * @author Nicolas Barradeau
	 * http://en.nicoptere.net
	 */
	public class PoissonSample extends BaseSample
	{
		
		public function PoissonSample( size:Number = 30 ) 
		{
			
			color = 0xFFFFFF;
			var points:Vector.<Point> = PoissonDisk.distribute( new Rectangle( 0,0,sw,sh ), size, 100000 );
			
			var m:Matrix = new Matrix();
			m.createGradientBox( size, size, 0, 0, 0 );
			
			graphics.clear();
			for each( var p:Point in points )
			{
				//m.tx = p.x;
				//m.ty = p.y;
				//graphics.beginGradientFill( 'radial', [0xFFFFFF, 0xFFFFFF, 0xFFFFFF], [ 1, .5, 0.0 ], [0,20, 0xFF], m );
				//graphics.beginFill( color, .1 );
				graphics.lineStyle( 2, color, .5 );
				graphics.drawCircle( p.x, p.y, size / 2);
				
				graphics.beginFill( color );
				graphics.drawCircle( p.x, p.y, 2 );
				graphics.endFill();
				
			}
			
		}
		
	}

}